﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Entity;
using System.Data;

namespace Controller
{
    public partial class Controller_Renters : Component
    {
        Entity_Renters ent_renter = new Entity_Renters();
        public Controller_Renters()
        {
            InitializeComponent();
        }

        public Controller_Renters(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }
        public int Insert_renter(string name, int sex, string cmnd, string noicap, string ngaycap, string diachi, string quanhuyen, string tinh, string quocgia, string dienthoai, string fax, string email, string didong)
        {
            int n = 0;
            try
            {
                DataSet ds = ent_renter._Insert_Renter(name, sex, cmnd, noicap, ngaycap, diachi, quanhuyen, tinh, quocgia, dienthoai, fax, email, didong);
                if (ds.Tables.Count != 0)
                    n = int.Parse(ds.Tables[0].Rows[0]["IDNew"].ToString());
            }
            catch (Exception)
            {
                n = 0;
            }
            
            return n;
          
        }

        public DataSet get_id_newest()
        {
            DataSet ds = new DataSet();
            ds = ent_renter._get_id_newest();
            return ds;
        }
    }
}
